package com.spring.quickstart.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.spring.quickstart.entity.User;
import com.spring.quickstart.mapper.IUserMapper;
import com.spring.quickstart.service.IUserService;

@Service
public class UserServiceImpl implements IUserService {

	@Autowired
	private IUserMapper userMapper;

	public IUserMapper getUserMapper() {
		return userMapper;
	}

	public void setUserMapper(IUserMapper userMapper) {
		this.userMapper = userMapper;
	}

	@Override
	public User getUserEntityById(String userId) {
		return this.userMapper.getUserEntityById(userId);
	}

	@Override
	public List<User> getUserEntities() {
		return this.userMapper.getUserEntities();
	}

	@Override
	public User insertUserEntity(User userEntity) {
		this.userMapper.insertUser(userEntity);

		return getUserEntityById(userEntity.getUserId());
	}

}
